function addmsg(msg){
	var ul = document.getElementById('chatlist');
	var li= document.createElement('li');
	li.innerHTML=msg;
	ul.appendChild(li);
}
function push(event) {
	addmsg(Url.decode(event));
}
 
function disconnected() {
	addmsg('the link is disconnected');
	document.getElementById('control').value = 'start';
}
 
function toggle() {
	if (!comet.active) {
		comet.open('http://192.168.1.210:9000/Hello.chat?opt=join', push, disconnected);
		document.getElementById('control').value = 'stop';
	} else {
		comet.close();
	}
}
